<template>
  <div>
    用户名 <input type="text" v-model="mobile">
    密码 <input type="text" v-model="password">
    <button @click="Postuser">登录</button>
  </div>
</template>

<script>
export default {
  name: "clogin",
  data() {
    return {
      mobile :'',
      password:''
    }
  },
  methods: {
    Postuser(){
      this.$axios.get('http://localhost:5000/user/login/',{params:{'mobile':this.mobile,'password':this.password}})
      .then(res=>{
          if (res.data.code == 200){
            alert('登陆成功')
            localStorage.getItem('userid',res.data.userid)
          }else if( res.data.code = 403){
            alert(res.data.msg)
          }else if(res.data.code==20020){
            alert('没有该用户')
          }
      })
    }
  },
  mounted() {

  }

}
</script>

<style scoped>

</style>
